<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:plcf="http://www.powerlogic.com.br/plcf"
	xmlns:plct="http://www.powerlogic.com.br/plct"
	xmlns:tr="http://myfaces.apache.org/trinidad"
	xmlns:trh="http://myfaces.apache.org/trinidad/html">
		
	<c:if test="#{empty requestScope.visualizaDocumentoPlc and requestScope.tabFolderAgilPlc=='S'}">
		<c:set var="nomeSubDetalhe" value="#{plct:exec (plcConfigUrlColaboracao,'getNomeSubDetalhe' )}"/>
		<c:set var="botaoSubDetalhe" value="exibe_jcompany_evt_incluir_subdetalhe_#{nomeSubDetalhe}"/>
		<fieldset class="plc-fieldset" id="corpo:formulario:fieldset:#{plcItensStatus.index}">
			<legend class="plc-fieldset-legend">
				<span id="portlet#{plcAliasPrefixoAction}det#{plcItensStatus.index}" 
					class="ico iMinimizar" 
					onclick="jQuery('#detCorrPlc').val('#{nomeSubDetalhe}'); retraiExpandeSubdetalhe (this, '#{plcItensStatus.index}'); "/>
					<c:set var="tituloSubDetalhe" value="#{plcAliasPrefixoAction}.subdetalhe.#{status.index}.titulo.comp"/>
					#{msg[tituloSubDetalhe]}	
			</legend>
			<span class="plc-corpo-acao-subdetalhe">
				<div class="plc-corpo-acao" id="corpo:formulario:novoComponente:#{plcItensStatus.index}">
					<div class="plc-corpo-acao-generico" id="novoComponente:#{plcItensStatus.index}">
						<plcf:botaoAcao acao="create" label="jcompany.evt.incluir.subdetalhe" botaoArrayID="NOVO" id="novoComponente"  idPlc="#{requestScope.id}"
							 partialSubmit="#{requestScope.ajaxUsa}" urlIcone="ico iNovo"
							 immediate="false" validaForm="false" rendered="#{(((requestScope[botaoSubDetalhe] != 'N') and (requestScope['exibe_jcompany_evt_incluir_subdetalhe'] != 'N')) or ((requestScope[botaoSubDetalhe] == 'S') and (requestScope['exibe_jcompany_evt_incluir_subdetalhe'] != 'N')) or ((requestScope[botaoSubDetalhe] == 'S') and (requestScope['exibe_jcompany_evt_incluir_subdetalhe'] == 'N')))}"
							 detalhe="#{ indexDetalhe == null ? nomeSubDetalhe : plct:execOneArg (plcConfigUrlColaboracao,'getNomeSubDetalhe', indexDetalhe )}"/>
					</div>
				</div>
			</span>
			<ui:include src="#{caminho}" />
		</fieldset>
	</c:if>
	<c:if test="#{not empty requestScope.visualizaDocumentoPlc or requestScope.tabFolderAgilPlc!='S'}">
		<c:set var="nomeSubDetalhe" value="#{plct:exec (plcConfigUrlColaboracao,'getNomeSubDetalhe' )}"/>
		<c:set var="botaoSubDetalhe" value="exibe_jcompany_evt_incluir_subdetalhe_#{nomeSubDetalhe}"/>
		
		<c:if test="#{empty requestScope.visualizaDocumentoPlc }">
			<span id="plc-acaosubdetalhe-#{plcItensStatus.index}" class="plc-corpo-acao-subdetalhe-sem-tab">
				<div class="plc-corpo-acao" id="corpo:formulario:novoComponente:#{plcItensStatus.index}">
					<div class="plc-corpo-acao-generico" id="novoComponente:#{plcItensStatus.index}">
						<plcf:botaoAcao acao="create" label="jcompany.evt.incluir.subdetalhe" botaoArrayID="NOVO" id="novoComponente"  idPlc="#{requestScope.id}"
						     partialSubmit="#{requestScope.ajaxUsa}" urlIcone="ico iNovo"
							 immediate="false" validaForm="false" rendered="#{(((requestScope[botaoSubDetalhe] != 'N') and (requestScope['exibe_jcompany_evt_incluir_subdetalhe'] != 'N')) or ((requestScope[botaoSubDetalhe] == 'S') and (requestScope['exibe_jcompany_evt_incluir_subdetalhe'] != 'N')) or ((requestScope[botaoSubDetalhe] == 'S') and (requestScope['exibe_jcompany_evt_incluir_subdetalhe'] == 'N')))}"
							 detalhe="#{ indexDetalhe == null ? nomeSubDetalhe : plct:execOneArg (plcConfigUrlColaboracao,'getNomeSubDetalhe', indexDetalhe ) }"/>
					</div>
				</div>
			</span>
		</c:if>
		<br/>
		<br/>	 		
		<ui:include src="#{caminho}" />
                <script type="text/javascript">
                //<![CDATA[
                jQuery(function(){
                        
                        var $fieldset = jQuery('#plc-acaosubdetalhe-#{plcItensStatus.index}').next();
                        $fieldset.attr('id', 'corpo:formulario:fieldset:#{plcItensStatus.index}');
                        
                        jQuery('<span class="ico iMinimizar"/>')
                        .prependTo($fieldset.find('legend:eq(0)'))
                        .click(function(){
                                jQuery('#detCorrPlc').val('#{nomeSubDetalhe}');
                                retraiExpandeSubdetalhe(this, '#{plcItensStatus.index}');
                        });
                });
                //]]>
                </script>		
	</c:if>
	
</ui:composition>